More on Algebra
Some Squares
If and are real numbers, then
Details
If and are real numbers, then:
This can be proven formally with the following argument:
Pascal's Triangle
Pascal's triangle is a geometric arrangement of the binomial coefficients in a triangle:
Details
To build Pascal's triangle, start with 1
at the top, and then continue placing numbers below it in a triangular pattern.
Each number is just the two numbers above it added together (except for the edges, which are all 1
).
Examples
The following function in R gives you the Pascal's triangle for to .
> fN <- function(n) formatC(n, width=2)
> for (n in 0:10) {
+ cat(fN(n),":", fN(choose(n, k = -2:max(3, n+2))))
+ cat("\n")
+ }
0 : 0 0 1 0 0 0
1 : 0 0 1 1 0 0
2 : 0 0 1 2 1 0 0
3 : 0 0 1 3 3 1 0 0
4 : 0 0 1 4 6 4 1 0 0
5 : 0 0 1 5 10 10 5 1 0 0
6 : 0 0 1 6 15 20 15 6 1 0 0
7 : 0 0 1 7 21 35 35 21 7 1 0 0
8 : 0 0 1 8 28 56 70 56 28 8 1 0 0
9 : 0 0 1 9 36 84 126 126 84 36 9 1 0 0
10 : 0 0 1 10 45 120 210 252 210 120 45 10 1 0 0
Changing the numbers in the line for(n in 0:10)
will give different portions of the triangle.
Factorials
We define the factorial of an integer n
as
For convenience we define to be 1
.
Details
We define the factorial of an integer n
as:
Examples
Suppose you have six apples: and you want to put each one into a different apple basket: .
For the first basket you can choose from 6
apples , and for the second basket you have then 5
apples to choose from and so it goes for the rest of the baskets, so for the last one you only have 1
apple to choose from.
The end result would then be possible allocations.
This could also be calculated in R with the factorial function:
> factorial(6)
[1] 720
Combinations
The number of different ways one can choose a subset of size from a set of elements is determined using the following calculation:
Details
A combination is an un-ordered collection of distinct elements.
Suppose we want to toss a coin times.
In each toss we obtain head (H
) or tail (T
) resulting in a sequence of H
, T
, T
, H
, ..., T
.
How many of these possible sequences contain exactly tails?
There are positions in the sequence, we can choose of these in ways and put our T
s in those positions.
If the probability of landing tails is , then each one of these sequences with exactly tails has probability
So the total probability of landing exactly tails in independent tosses is:
Examples
Consider tossing a coin four times:
(a) How many times will this experiment result in exactly 2
tails?
There are a total of 16
possible sequences of heads and tails from 4
tosses.
These can simply all be written down to answer a question like this
We get two tails in 6
of these tosses.
We can explicitly write the corresponding combinations of two tails as follows:
HHTT HTHT HTTH THTH TTHH THHT
(b) How many times you will end up with 1
tail? The answer is 4
times and the output can be written as:
HHHT HTHH THHH HHTH
The case of a single tail is easy: The single tail can come up in any one of four positions.
The Binomial Theorem
Details
If and are real numbers and is an integer then the expression can be expanded as:
This can be seen by looking at as a product of parentheses and multiply these by picking one item ( or ) from each. If we picked from parentheses and from , then the product is . We can choose the 's in a total of ways so the coefficient of is .
Examples
Since
it follows that
i.e.